﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class VehicleUI_Insurance_InsuranceAMV : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["Type"] == null)
        {
            DetailsView1.ChangeMode(DetailsViewMode.Insert);
        }
        else if (Request.QueryString["Type"].ToString() == "View")
        {
            DetailsView1.ChangeMode(DetailsViewMode.ReadOnly);
        }
        else
        {
            DetailsView1.ChangeMode(DetailsViewMode.Edit);
        }



        if (!Page.IsPostBack)
        {
            if (DetailsView1.CurrentMode == DetailsViewMode.ReadOnly) return;
            PageCommonService.AddRequiredFieldValidator(DetailsView1, 1);
            PageCommonService.AddRequiredFieldValidator(DetailsView1, 2);
            PageCommonService.AddRequiredFieldValidator(DetailsView1, 3);
            PageCommonService.AddRequiredFieldValidator(DetailsView1, 4);
            PageCommonService.AddRequiredFieldValidator(DetailsView1, 5);
            PageCommonService.AddRequiredFieldValidator(DetailsView1, 6);
            PageCommonService.AddRequiredFieldValidator(DetailsView1, 7);
            PageCommonService.AddRequiredFieldValidator(DetailsView1, 8);
        }

    }
    protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
        e.Values["OrganID"] = Session["OrganID"].ToString();
        e.Values["InputBy"] = Session["UserID"].ToString();
    }
}
